//-----------------------------------------------------------------------
// <copyright file="GiftServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using BirthdayReminder.Entities;
using BirthdayReminder.Data;
    
namespace BirthdayReminder.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class GiftServiceBase
    {
        #region GiftServiceBase

        public static void CreateGift(Gift gift)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                giftDAO.CreateGift(gift);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreateGiftException, ex);
            }
        }

        public static void UpdateGift(Gift gift)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                giftDAO.UpdateGift(gift);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdateGiftException, ex);
            }
        }        

        public static void DeleteGift(int giftId)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                giftDAO.DeleteGift(giftId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeleteGiftException, ex);
            }
        }
		
        public static Gift GetGift(int giftId)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGift(giftId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetGiftException, ex);
            }
        }                
		
        public static GiftCollection GetGiftList(GiftColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGiftList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetGiftListException, ex);
            }
        }        

        public static GiftCollection GetGiftList(GiftColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGiftList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetGiftListException, ex);
            }
        }        
		
		
        #endregion
    }
}